<?php
/**
 * BaseView
 * - Handle all common actions of a view
 * @author Do Truong Giang
 */
include_once(DOCUMENT_ROOT . "/lib/core/Validator.class.php");
class BaseView {
	// attributes are list of request parameters associated to a page
	private $attributes;
	// listAttribute is the list of all attributes name associated to a page
	protected $listAttributes;
	// errors is the array contains all errors
	protected $errors;
	// index is used when the view contains array attributes
	protected $index;
	// token is used for security
	protected $token;
	/**
	 * Constructor
	 */
	public function BaseView() {
		$this->attributes = array();
		$this->listAttributes = array();
		$this->errors = array();
	}
	/**
	 * getAttributes
	 * - Return all attributes of this object
	 */
	public function getAttributes() {
		return $this->attributes;
	}
	public function setAttributes($att) {
		$this->attributes = $att;
	}
	/**
	 * setAttribute
	 * - Set the attribute
	 */
	public function setAttribute($attName, $value) {
		$this->attributes[$attName] = $value;
	}
	/**
	 * getAttribute
	 * - Return the value of a attribute
	 */
	public function getAttribute($attName) {
		if (isset($this->attributes[$attName])) {
			return $this->attributes[$attName];
		}
		return null;
	}
	/**
	 * getIndex
	 * - Return the index
	 */
	public function getIndex() {
		return $this->index;
	}
	/**
	 * setIndex
	 * - Set the index array
	 * @param Array $idx The array of index for each attribute
	 */
	public function setIndex($idx) {
		$this->index = $idx;
	}
	/**
	 * getHiddenTagOfIndex
	 * - Return the hidden tag of all index to pass through HTTP
	 */
	public function getHiddenTagOfIndex() {
		$html = "";
		if (is_array($this->index)) {
			foreach ($this->index as $idx) {
				$html .= "<input type='hidden' name='__sysIdx[]' value='$idx'>";
			}
		}
		return $html;
	}
	/**
	 * decodeHtml
	 * - Return html code of string, with normal special HTML characters
	 * @param String $str
	 * @return String HTML code
	 * 
	 */
	public static function decodeHtml($str) {
		$replace = array("&amp;", "&quot;", "&#039;", "&lt;", "&gt;");
		$replaced = array("&", "\"", "\'", "<", ">");
		$str = str_replace($replace, $replaced, $str);
		$str = str_replace("&amp;#", "&#", $str);
		return $str;
	}
	/**
	 * getParam
	 * - Return the request parameter, replace special characters
	 * @param String $param The parameter name
	 * @return String String after replace special characters
	 */
	
	public static function getParam($param) {
		if (is_array($_REQUEST[$param])) {
			array_walk_recursive($_REQUEST[$param], array(BaseView, 'handleRequestParam'));
		}
		else {
			$_REQUEST[$param] = self::handleRequestString($_REQUEST[$param]);
		}
		return $_REQUEST[$param];
	}
	private static function handleRequestParam(&$value, $index) {
		$value = self::handleRequestString($value);
	}
	public static function handleRequestString($string) {
		$replace = array("&", "\"", "\'", "<", ">");
		$replaced = array("&amp;", "&quot;", "&#039;", "&lt;", "&gt;");
		$str = str_replace($replace, $replaced, $string);
		$str = str_replace("&amp;#", "&#", $str);
		return $str;
	}
	/**
	 * setAll
	 * - Set all request parameters to the attributes
	 */
	public function setAll() {
		foreach ($this->listAttributes as $attName) {
			if (isset($_REQUEST[$attName])) {
				if ($_REQUEST[$attName] !== "") {
					$this->setAttribute($attName, $this->getParam($attName));
				}
				else {
					$this->setAttribute($attName, null);
				}
			}
			else {
				$this->setAttribute($attName, null);
			}
		}
		if (isset($_REQUEST["__sysIdx"])) {
			$this->setIndex($_REQUEST["__sysIdx"]);
		}
	}
	/**
	 * addError
	 * - Add an error to this object which can be help to show the errors
	 */
	public function addError($errorField, $errorType, $index = null) {
		if (!isset($this->errors[$errorField])) {
		$this->errors[$errorField] = array();
		}
		if ($index === null) {
			$index = -1;
		}
		if (!is_array($this->errors[$errorField][$index])) {
			$this->errors[$errorField][$index] = array();
		}
		$this->errors[$errorField][$index][] = $errorType;
	}
	public function getErrors() {
		return $this->errors;
	}
	public function setErrors($errors) {
		$this->errors = $errors;
	}
	public function hasError() {
		if (empty($this->errors)) {
			return false;
		}
		return true;
	}
	/**
	 * getCodeDef
	 * - Return the array of codeDef
	 */
	public function getCodeDef($name) {
		global $codeDef;
		$returnArr = array();
		foreach ($codeDef[$name] as $key => $value) {
			$returnArr[$key] = $value[0];
		}
		return $returnArr;
	}
	/**
	 * randomToken
	 * - Set random token for security
	 * @author Nguyen Thanh Quyen
	 * @since 1.0 - 14-07-2009
	 */
	public static function randomToken() {
		// Set the random token to session
		// Check session
		if(!isset($_SESSION["__token"])) {
			$token = md5(uniqid(rand(), true));
			$_SESSION["__token"] = $token;
		}
	}
	/**
	 * forward
	 * - Forward a view to another page
	 * @param String $module The module fowarded to
	 * @param String $action The action forwarded to
	 * @param Object $view The view object
	 */
	public static function forward($module, $action, $view, $params = null) {
		// Get token
		$token = "token=" . $_SESSION["__token"];
		// Set the view object to session
		$_SESSION["__sysViewAtts"] = serialize($view->getAttributes());
		$_SESSION["__sysViewErrs"] = serialize($view->getErrors());
		$_SESSION["__sysIdx"] = serialize($view->getIndex());
		header("Location:index.php?m=$module&a=$action&$params&$token");
		exit();
	}
	/**
	 * fetchForwardedView
	 * - Get the view object sent by forward function
	 * - Remove the view object from session to save memory
	 * @
	 */
	public function fetchForwardedView() {
		$this->setAttributes(unserialize($_SESSION["__sysViewAtts"]));
		$this->setErrors(unserialize($_SESSION["__sysViewErrs"]));
		$this->setIndex(unserialize($_SESSION["__sysIdx"]));
		session_unregister("__sysViewAtts");
		session_unregister("__sysViewErrs");
		session_unregister("__sysIdx");
	}
	/**
	 * hasForwardedView
	 * - Return true if a forwarded view exists in session
	 * - otherwise, return false 
	 */
	public static function hasForwardedView() {
		if (isset($_SESSION["__sysViewAtts"])||($_SESSION["__sysViewErrs"])||($_SESSION["__sysIdx"])) {
			return true;
		}
		return false;
	}
	/**
	 * postShowHtml
	 * - This function is run after getHtmlOfxxx
	 * - Check if field has error or not, if it  has, create a link to it
	 * @param String $name The name of an input tag.
	 * @return String
	 */
	protected function postShowHtml($name, $index = null) {
		$html = "";
		if (!empty($this->errors)) {
			foreach ($this->errors as $fieldName => $info) {
				if (is_array($info)) {
					if ($fieldName == $name) {
						foreach ($info as $idx => $errorType) {
							if ($index == $idx) {
								$html = "<a name='#$name" . "[$idx]'></a> <img src='images/fr_error_icon.gif'>";
							}
							return $html;
						}
					}
				}
				else {
					if ($fieldName == $name) {
						$html = "<a name='#$name'></a> <img src='images/fr_error_icon.gif'>";
						break;
					}
				}
			}
		}
		return $html;
	}
	/**
	 * showErrors
	 * - Display all errors
	 */
	public function showErrors() {
		$errorMessage = "";
		// Now, show the errors on page
		if (!empty($this->errors)) {
			// Get all errors of page from database
			include_once(DOCUMENT_ROOT . "/lib/dao/ErrorMessage.class.php");
			$objErrorMessage = new ErrorMessage();
			$rs = $objErrorMessage->fetchErrorsOfPage($this->objectName);
			$errors = array();
			foreach($rs as $row) {
				$fieldName = $row["field_name"];
				$code = $row["error_code"];
				$message = $row["message"];
				if (!isset($errors[$fieldName])) {
					$errors[$fieldName] = array();
				}
				$errors[$fieldName][$code] = $message;
			}
			// Show all errors
			$errorMessage = "<div style='border: 1px solid #FF0000;background-color:#FFFFCC;font-size:100%;padding: 5px;margin:15px auto;width:70%;'>";
			$errorMessage .= "<span style='color:red;font-size:110%;font-weight:bold;padding-left:5px;'>Error:</span><br>";
			foreach ($this->errors as $fieldName => $info) {
				$shownTypes = array();
				foreach ($info as $index => $type) {
					foreach ($type as $errorType) {
						if (!in_array($errorType, $shownTypes)) {
							if ($index != -1) {
								$linkTo = $fieldName . "[$index]";
							}
							else {
								$linkTo = $fieldName;
							}
							$errorMessage .= "<span style=\"background: url(images/fr_error_icon.gif) no-repeat;padding-left:20px;\"><a href='#$linkTo' style='color:#000000'>" . $errors[$fieldName][$errorType] . "</a></span><br>";
							$shownTypes[] = $errorType;
						}
					}
				}
			}
			$errorMessage .= "</div>";
		}
		return $errorMessage;
	}
	/**
	 * formTag
	 * - Show the form tag
	 * @param Array|null $params The array of parameters like method, enctype, id, name
	 */
	public static function formTag ($module, $action, $params = null) {
		$token = $_SESSION["__token"];
		$paraStr = "";
		if ($params === null) {
			$paraStr = "method='POST'";
		}
		else {
			foreach ($params as $name => $value) {
				$paraStr .= "$name=\"$value\" "; 
			}
		}
		$html = "<form action='index.php' $paraStr>";
		$html .= "<input type='hidden' name='m' id='m' value='$module'>";
		$html .= "<input type='hidden' name='a' id='a' value='$action'>";
		$html .= "<input type='hidden' name='token' id='token' value='$token'>";
		return $html;
	}
	/**
	 * linkTag
	 * - show the link tag
	 * @author Nguyen Thanh Quyen
	 * @since 1.0 - Jul 8, 2009
	 */
	public static function linkTag ($module, $action, $params = null, $additional = null) {
		$token = "token=" . $_SESSION["__token"];
		$html = "<a href=\"index.php?m=$module&a=$action&$token&$additional\" $params>";
		return $html;
	}
	/**
	 * redirect
	 * - Redirect to other page
	 */
	public static function redirect($module, $action, $params = null) {
		echo '567';
		header("Location:index.php?m=$module&a=$action");
		exit();
	}
	/**
	 * to2Byte
	 * - Convert a string to 2-byte string
	 * @author Do Truong Giang
	 * @since 1.0 - Aug 27, 2008
	 * 
	 * @param String $str The string to convert
	 * @return String 2-byte string
	 */
	public static function to2Byte($str) {
		$str = mb_convert_kana($str, "KAV");
		return $str;
	}
	/**
	 * to1Byte
	 * - Convert a string to 1-byte string
	 * @author Do Truong Giang
	 * @since 1.0 - Aug 27, 2008
	 * 
	 * @param String $str The string to convert
	 * @return String 1-byte string
	 */
	public static function to1Byte($str) {
		$str = mb_convert_kana($str, "kaV");
		return $str;
	}
	
	/**
	 * getHtmlOfText
	 * - Code of form input text
	 * @return String
	 * @param String $name
	 * @param String $value
	 * @param String $style
	 * @param String $class
	 * @param String $additional
	 * @since 1.0 - 07-05-2009
	 * @author Nguyen Thanh Quyen
	 */
	 public function getHtmlOfText($name, $value, $style, $class, $isArray, $additional, $index = null){
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code = "";
		$code .= "<input type=\"text\" name=\"$name$asArray\" value=\"$value\" style=\"$style\" class=\"$class\" $additional>";
		$code .= $this->postShowHtml($name, $index);
		return $code;
	 }
	 
	 /**
	  * getHtmlOfPassword
	  * - Code of form input password
	  * @return String $code
	  * @param String $name
	  * @param String $style
	  * @param String $class
	  * @param String $additional
	  * @since 1.0 - 07-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHtmlOfPassword($name, $value, $style, $class, $isArray, $additional, $index = null) {
	  	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	  	$code = "";
		$code .= "<input type=\"password\" name=\"$name$asArray\" value=\"$value\" style=\"$style\" class=\"$class\" $additional>";
		$code .= $this->postShowHtml($name, $index);
		return $code;
	 }
	 
	 /**
	  * getHtmlOfTextArea
	  * - Code of form input textarea
	  * @return String
	  * @param String $name
	  * @param String $style
	  * @param String $class
	  * @param String $col
	  * @param String $row
	  * @param String $additional
	  * @since 1.0 - 07-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHtmlOfTextArea($name, $value, $style, $class, $isArray, $col, $row, $additional, $index = null){
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code = "";
		$code .= "<textarea cols=\"$col\" rows=\"$row\" name=\"$name$asArray\" style=\"$style\" class=\"$class\" $additional>" . html_entity_decode($value, ENT_COMPAT, "utf-8") . "</textarea>\n";
		$code .= $this->postShowHtml($name, $index);
		return $code;
	 }
	 
	 /**
	  * getHtmlOfSelect
	  * - Code of select
	  * @return String
	  * @param String $name
	  * @param String $style
	  * @param String $class
	  * @param String $value
	  * @param String $selectInfo
	  * @param String $additional
	  * @param String $index
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHtmlOfSelect($name, $value, $selectInfo, $style, $class, $isArray, $additional, $index = null ) {
 		$code = "";
 		$asArray = "";
 		if($isArray == 'true') {
 			$asArray = "[]";
 		}
 		$code .= "<select name=\"$name$asArray\" class=\"$class\" style=\"$style\" $additional>\n";
		foreach ($selectInfo as $key => $val) {
			$selected = "";
			if ($key == $value) {
				$selected = " selected";
			}
			$code .= "		 <option value=\"$key\" $selected >". $val ."</option>\n";
		}
		$code .= "</select>";
		$code .=$this->postShowHtml($name, $index);
		return $code;
	 }
	 
	 /**
	  * getHtmlOfRadio
	  * - Code of radio
	  * @return String
	  * @param String $name
	  * @param String $style
	  * @param String $class
	  * @param String $value : the value selected
	  * @param String $radioInfo
	  * @param String $additional
	  * @param String $index
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHtmlOfRadio($name, $value, $radioInfo, $style, $class, $isArray, $col, $additional, $index = null) {
 		$code = "";
 		$i = 0;
 		$asArray = "";
 		if($isArray == 'true') {
 			$asArray = "[]";
 		}
 		$code .= "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"$class\" style=\"$style\">\n";
		foreach ($radioInfo as $key => $val) {
			if ($i % $col == 0) {
				$code .= "<tr>";
			}
			$i++;
			$t = 1/$col * 100;
			$code .= "<td width=\"$t%\">";
			$checked = '';
			if ($key == $value) {
				$checked = ' checked';
			}
			$code .= "<input type=\"radio\" name=\"$name$asArray\" value=\"$key\" $checked $additional> $val";
			$code .= "</td>";
			if ($i % $col == 0) {
				$code .= "</tr>";
			}
		}
		while ($i % $col != 0) {
			$i++;
			$code .= "<td>&nbsp;</td>";
			if ($i % $col == 0) {
				$code .= "</tr>";
			}
		}
		$code .= "</table>";
		$code .=$this->postShowHtml($name, $index);
		return $code;
	 }
	 
	 /**
	  * getHtmlOfCheckbox
	  * - Code of check box
	  * @return String
	  * @param String $name
	  * @param String $style
	  * @param String $class
	  * @param String $value : the value selected
	  * @param String $checkboxInfo
	  * @param String $additional
	  * @param String $index
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHtmlOfCheckbox($name, $value, $checkboxInfo, $style, $class, $isArray, $col, $additional, $index = null) {
 		$code = "";
 		if((count($checkboxInfo) > 1)||($isArray == 'true')) {
 			$asArray = "[]";
 		}
 		$i = 0;
		if (is_array($value)) {
			$selectedValues = $value;
		}
		else {
			$selectedValues = array($value);
		}
		$code .= "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"$class\" style=\"$style\">";
		foreach ($checkboxInfo as $key => $val) {
			if ($i % $col == 0) {
				$code .= "<tr>";
			}
			$i++;
			$t = 1/$col * 100;
			$code .= "<td width=\"$t%\">";
			$checked = "";
			if (in_array($key, $selectedValues)) {
				$checked = ' checked';
			}
			$code .= "<input type=\"checkbox\" name=\"$name$asArray\" value=\"$key\" $checked $additional> $val";
			$code .= "</td>";
			if ($i % $col == 0) {
				$code .= "</tr>";
			}
		}
		while ($i % $col != 0) {
			$i++;
			$code .= "<td>&nbsp;</td>";
			if ($i % $col == 0) {
				$code .= "</tr>";
			}
		}
		$code .= "</table>";
		$code .= $this->postShowHtml($name, $index);
		return $code;
	 }
	 
	 /**
	  * getHtmlOfFile
	  * - Code of input file
	  * @return String
	  * @param String $name
	  * @param String $style
	  * @param String $class
	  * @param String $additional
	  * @param String $index
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHtmlOfFile($name, $style, $class, $isArray, $additional) {
	 	$code = "";
	 	$code .= "<input type=\"file\" name=\"$name\" style=\"$style\" class=\"$class\" $additional>";
	 	$code .= $this->postShowHtml($name);
	 	return $code;
	 }
	 
	 /**
	  * getDisplayOfText
	  * - Content of text
	  * @return String : value of text input
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getDisplayOfText($value) {
	 	return $value;
	 }
	 
	 /**
	  * getDisplayOfPassword
	  * - Content of password
	  * @return String : value of password input by ***
	  * @since 1.1 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getDisplayOfPassword($value) {
			$code = "";
			$c = strlen($value);
			for ($i = 0; $i < $c; $i++) {
				$code .= "*";
			}
			return $code;
	 }
	 
	 /**
	  * getDisplayOfTextArea
	  * - Content of text area
	  * @return String : value of text area input
	  * @param String $value
	  * @since 1.1 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getDisplayOfTextArea($value) {
	 	return nl2br(htmlentities($value, ENT_COMPAT, "utf-8"));
	 }
	 
	 /**
	  * getDisplayOfSelect
	  * - Content of select box
	  * @return String : selected value of select box
	  * 
	  */
	 public function getDisplayOfSelect($selectInfo, $value) {
		$code = $selectInfo[$value];	
	 	return $code;
	 }
	 
	 /**
	  * getDisplayOfRadio
	  * - Content of Radio box
	  * @return String : selected value of radio box
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getDisplayOfRadio($radioInfo, $value) {
	 	$code = $radioInfo[$value];
	 	return $code;
	 }
	 
	 /**
	  * getDisplayOfCheckbox
	  * - Content of Check box
	  * @return String : checked value of check box
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getDisplayOfCheckbox($checkboxInfo, $value) {
 		$code = "";
 		$delimiter = ($delimiter == null ? ',' : $delimiter);
		if (is_array($value)) {
			$selectedValues = $value;
		}
		$c = count($selectedValues);
		$i = 0;
		foreach ($selectedValues as $val) {
			$code .= $checkboxInfo[$val];
			$i++;
			if ($i < $c) {
				$code .= $delimiter;
			}
		}
		return $code;
	 }
	 
	 /**
	  * getDisplayOfFile
	  * - Content of file input
	  * @return String :  value of file input
	  * @param String $value
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getDisplayOfFile($value) {
	 	// not implement for isArray
	 	return $value;
	 }
	 
	 /**
	  * getHiddenTagOfText
	  * - Code of hidden text tag
	  * @return String : code
	  * @param String $value
	  * @param String $index
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfText($name, $value, $isArray) {
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code = "<input type=\"hidden\" name=\"$name$asArray\" value=\"" . str_replace('\"', '\\\"', $value) . "\">";
	 	return $code;
	 }
	 
	 /**
	  * getHiddenTagOfPassword
	  * - Code of hidden password tag
	  * @return String : code
	  * @param String $value
	  * @param String $name
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfPassword($name, $value, $isArray) {
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code = "<input type=\"hidden\" name=\"$name$asArray\" value=\"$value\">";
	 	return $code;
	 }
	 
	 /**
	  * getHiddenTagOfTextArea
	  * - Code of hidden text area
	  * @return String : code
	  * @param String $name
	  * @param String $value
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfTextArea($name, $value, $isArray) {
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code = "<input type=\"hidden\" name=\"$name$asArray\" value=\"$value\">";
	 	return $code;
	 }
	 
	 /**
	  * getHiddenTagOfSelect
	  * - Code of hidden select tag
	  * @return String : code
	  * @param String $name
	  * @param String $value
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfSelect($name, $value, $isArray) {
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code .= "<input type=\"hidden\" name=\"$name$asArray\" value=\"$value\">";
	 	return $code;
	 }
	 
	 /**
	  * getHiddenTagOfRadio
	  * - Code of hidden radio tag
	  * @return String : code
	  * @param String $name
	  * @param String $value
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfRadio($name, $value, $isArray) {
	 	$asArray = "";
	 	if($isArray == 'true') {
	 		$asArray = "[]";
	 	}
	 	$code = "<input type=\"hidden\" name=\"$name$asArray\" value=\"$value\">";
	 	return $code;
	 }
	 
	 /**
	  * getHiddenTagOfCheckbox
	  * - Code of hidden checkbox tag
	  * @return String : code
	  * @param String $name
	  * @param String $value
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfCheckbox($name, $selectedValues, $isArray){
	 	$code = "";
	 	$asArray = "[]";
	 	if (is_array($selectedValues)) {
			foreach ($selectedValues as $value) {
				$code .= "<input type=\"hidden\" name=\"$name$asArray" . "\" value=\"$value\">";
			}
		}
		else if ($selectedValues != null){
			$code .= "<input type=\"hidden\" name=\"$name$asArray\" value=\"$selectedValues\">";
		}
		return $code;
	 }
	 
	 /**
	  * getHiddenTagOfFile
	  * - Code of hidden file tag
	  * @return String : code
	  * @param String $name
	  * @param String $value
	  * @since 1.0 - 08-05-2009
	  * @author Nguyen Thanh Quyen
	  */
	 public function getHiddenTagOfFile($name, $value, $isArray) {
	 	// not implement for isArray
	 	$code = "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
	 	return $code;
	 }
}
?>